﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;

namespace NJL.WebUsers
{
    public partial class TripInformation : BasePageVisitor
    {
        private readonly BLL.NJL_TRIP_LINE bll = new BLL.NJL_TRIP_LINE();
        protected Model.NJL_TRIP_LINE MODEL;

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                LoadData();
                LoadPageSEO();
            }
        }

        /// <summary>
        /// 加载页面SEO
        /// </summary>
        private void LoadPageSEO()
        {
            Page.Title = MODEL.SEO_TITLE;

            HtmlMeta myMeta = new HtmlMeta();
            myMeta.Name = "Keywords";
            myMeta.Content = MODEL.SEO_KEYWORDS;
            this.Header.Controls.Add(myMeta);

            HtmlMeta myMeta1 = new HtmlMeta();
            myMeta1.Name = "Description";
            myMeta1.Content = MODEL.SEO_DESCRIPTION;
            this.Header.Controls.Add(myMeta1);
        }

        private void LoadData()
        {
            if (Request.QueryString["id"] != null && Request.QueryString["id"] != "")
            {
                MODEL = bll.GetModel(Request.QueryString["id"]);
                if (MODEL == null)
                {
                    Response.Redirect("/Default.aspx", true);
                }
            }
            else
            {
                Response.Redirect("/Default.aspx", true);
            }
        }
    }
}